package org.deltaset.samples.mvc.menu;

import java.util.List;
import javax.annotation.ManagedBean;
import java.io.Serializable;
import javax.inject.Inject;
import org.deltaset.desktop.AppItem;
import org.deltaset.desktop.TopMenuProvider;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.web.context.WebApplicationContext;

/**
 *
 * @author dmakariev
 */
@ManagedBean
@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.INTERFACES)
public class TopMenuProviderImpl implements TopMenuProvider, Serializable {

    private final MenuRegistry menuRegistry;

    @Inject
    public TopMenuProviderImpl(MenuRegistry menuRegistry) {
        this.menuRegistry = menuRegistry;
    }

    @Override
    public List<AppItem> loadTopMenu() {
        return menuRegistry.loadTopMenu();
    }
}
